package com.ibeeking.found.auth.api.feign;

import com.ibeeking.found.auth.api.common.dto.LoginOpenUserDTO;
import com.ibeeking.found.auth.api.common.dto.LoginUserDTO;
import com.ibeeking.found.auth.api.common.query.AccountLoginQuery;
import com.ibeeking.found.auth.api.feign.fallback.TenantLoginFallbackFactory;
import com.ibeeking.nematos.utils.result.ResponseResult;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;

import java.util.List;

/**
 * @Author ibeeking
 */
@FeignClient(name = "base-upms-b-server", path = "/b", contextId = "tenantLoginClient", fallbackFactory = TenantLoginFallbackFactory.class, decode404 = true)
public interface TenantLoginClient {

    /**
     * 租户端登录
     *
     * @param query
     * @return
     */
    @PostMapping(value = "/user/feign/v1/queryAccountLogin")
    ResponseResult<LoginUserDTO> queryAccountLogin(@RequestBody AccountLoginQuery query);

    /**
     * Open端登录
     *
     * @param appId
     * @return
     */
    @PostMapping(value = "/openuser/feign/v1/queryLoginUser/{appId}")
    ResponseResult<LoginOpenUserDTO> queryLoginUser(@PathVariable("appId") String appId);

    /**
     * 查询当前用户所属租户
     *
     * @param userId
     * @return
     */
    @PostMapping(value = "/user/feign/v1/queryByUserId/{userId}")
    ResponseResult<List<Integer>> queryByUserId(@PathVariable("userId") Long userId);
}
